Int

Local Variable Declaration Statement

Syntax samples

INT <name1>{= <expression1>, <name2>= <expression2>...)

INT Count

INT Count = 1

INT Count = 1, Test = FREECAP(Loc2)

Description

Creates a local variable of type integer. Local variables work much the same as attributes, except that they only are available within the logic that declares them. A new variable will be created for each entity that encounters an INT statement. Local variables are not directly available to subroutines, which have their own local variables. However, a local variable may be passed to a subroutine as a parameter. Local variables are available inside referenced macros.

Use local variables where ever possible for the test variable in WHILE...DO, DO...WHILE, and DO...UNTIL loops.

Valid In

Any logic. Variables declared with INT are valid in any expression within the logic where a normal integer number is valid.

Components

<names>

An identifier for the local variable. This identifier must be a valid name.

<expressions>

The variable will initially be assigned this value. This expression is evaluated every time the INT statement is encountered.

Example

A plant manufactures pipes of 12 different types, such as 2" steel, 4" aluminum, etc. All workers inspect pipes at a common inspection station after which they move to a dock where other workers load them into boxes. The boxes are designed to hold only certain types of pipes. Therefore a box designed to hold 2" steel pipes can only hold 2" steel pipes, not 4" aluminum pipes.

Suppose a Box, enters a multi-capacity location, Dock. Each Box has a different entity attribute, b_type, describing the type of pipe it can hold. Workers load pipes into the Box. Workers must load the 2" steel pipes into the box designed to hold the 2" steel pipes. Therefore, the attribute value of the Pipe, p_type, must match the attribute value of the Box, b_type. We can use local variables to accomplish this modeling task. In the following example, we defined X as a local variable and set it equal to b_type:

Process Table

Entity

Location

Operation (min)

Pipe

Inspect

WAIT 5

Box

Dock

INT X= b_type

LOAD 5 IFF

X=p_type

Box

Dock

WAIT 10

Routing Table

Blk

Output

Destination

Rule

Move Logic

1

Pipe

Dock

LOAD 1

MOVE FOR 2

 

 

 

 

 

 

 

1

Box

Delivery

FIRST 1

MOVE FOR 8

See Also

REAL. Also see Local Variables.